<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=100, initial-scale=1.0" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="" />
    <title>武陵游</title>
    <!-- weui 样式 -->
    <link rel="stylesheet" type="text/css" href="/paycss/style.css" />
    <script src="/payjs/jquery.min.js"></script>
    <!-- 调试用的移动端 console -->
    <!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script> -->
    <!-- <script>eruda.init();</script> -->
    <!-- 公众号 JSSDK -->
    <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <!-- 云开发 Web SDK -->
    <script src="https://res.wx.qq.com/open/js/cloudbase/1.1.0/cloud.js"></script>
    <script src="/payjs/ajax.js "></script>
    <script>
        var _baseUrl = 'https://payseryc.mj.9lhgame.com'
        var _code = getParameterStr("code")
        function docReady(fn) {
            if (document.readyState === 'complete' || document.readyState === 'interactive') {
                fn()
            } else {
                document.addEventListener('DOMContentLoaded', fn);
            }
        }

        docReady(async function () {
            var ua = navigator.userAgent.toLowerCase()
            var isWXWork = ua.match(/wxwork/i) == 'wxwork'
            var isWeixin = !isWXWork && ua.match(/micromessenger/i) == 'micromessenger'
            var isMobile = false
            var isDesktop = false
            if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|IEMobile)/i)) {
                isMobile = true
            } else {
                isDesktop = true
            }


                alert('333333');

                var c = new cloud.Cloud({
                    // 必填，表示是未登录模式
                    identityless: true,
                    // 资源方 AppID
                    resourceAppid: 'wxdada9bc45300a359', // <!-- replace -->
                    // 资源方环境 ID
                    resourceEnv: 'cloud1-3gua9rkm875bd364', // <!-- replace -->
                })
                await c.init()
                window.c = c

                var buttonEl = document.getElementById('public-web-jump-button')
                var buttonLoadingEl = document.getElementById('public-web-jump-button-loading')
                try {
                    await openWeapp(() => {
                        buttonEl.classList.remove('weui-btn_loading')
                        buttonLoadingEl.classList.add('hidden')
                    })
                } catch (e) {
                    buttonEl.classList.remove('weui-btn_loading')
                    buttonLoadingEl.classList.add('hidden')
                    throw e
                }

        })

        async function openWeapp(onBeforeJump) {
            var c = window.c
            var orderId="[[${orderId}]]"
            alert(orderId)
            const res = await c.callFunction({
                name: 'public',
                data: {
                    action: 'getUrlScheme',
                    orderId: orderId,
                    path: "pages/index/index"
                },
            })
            alert(JSON.stringify(res))
            if (onBeforeJump) {
                onBeforeJump()
            }
            location.href = res.result.openlink
        }
        // 根据键获取url参数值
        function getParameterStr(name) {
            let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            let r = location.search.substr(1).match(reg);
            if (r != null) return decodeURI(decodeURIComponent(decodeURI(r[2]))); return "";
        }
    </script>
    <style>
        .full {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
        }

        .public-web-container {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .public-web-container p {
            position: absolute;
            top: 40%;
        }

        .public-web-container a {
            position: absolute;
            bottom: 40%;
        }

        .wechat-web-container {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .wechat-web-container p {
            position: absolute;
            top: 40%;
        }

        .wechat-web-container wx-open-launch-weapp {
            position: absolute;
            bottom: 40%;
            left: 0;
            right: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .desktop-web-container {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .desktop-web-container p {
            position: absolute;
            top: 40%;
        }
    </style>
</head>

<body>
<div class="order_info">
    <p class="title"></p>
    <p class="product_name">商品名称：<span id="masonryNum"></span></p>
    <p class="order_player">充值账户：<span id="nickname"></span></p>
    <p class="order_money">支付金额：<span id="payMoney"></span></p>
</div>
<div class="btns">
    <button class="button pay" type="button" onclick="openWeapp()">
        支付
    </button>
</div>
<div class="order_warn">
    <p class="title">充值说明：</p>
    <p>1.钻石商品为虚拟物品，一经出售，概不退还</p>
    <p>2.支付遇到问题?请联系客服微信:cdkf008</p>
    <p>3.请合理安排时间,享受健康生活.</p>
</div>




<!--<div class="page full">-->
<!--    <div class="full public-web-container" >-->
<!--        <a id="public-web-jump-button" href="javascript:" class="weui-btn weui-btn_primary weui-btn_loading"-->
<!--           onclick="openWeapp()">-->
<!--                <span id="public-web-jump-button-loading"-->
<!--                      class="weui-primary-loading weui-primary-loading_transparent"><i-->
<!--                        class="weui-primary-loading__dot"></i></span>-->
<!--            打开小程序-->
<!--        </a>-->
<!--    </div>-->
<!--&lt;!&ndash;    <div id="wechat-web-container">&ndash;&gt;-->
<!--&lt;!&ndash;        <p class="">点击以下按钮打开 “填入你的小程序名称”</p> &lt;!&ndash; replace &ndash;&gt;&ndash;&gt;-->
<!--&lt;!&ndash;        &lt;!&ndash; 跳转小程序的开放标签。文档 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html &ndash;&gt;&ndash;&gt;-->
<!--&lt;!&ndash;        <wx-open-launch-weapp id="launch-btn" username="gh_3295cff1e5e3"&ndash;&gt;-->
<!--&lt;!&ndash;                              th:path="${payPath}">&ndash;&gt;-->
<!--&lt;!&ndash;            &lt;!&ndash; replace &ndash;&gt;&ndash;&gt;-->
<!--&lt;!&ndash;            <template>&ndash;&gt;-->
<!--&lt;!&ndash;                <button  class="button pay"&ndash;&gt;-->
<!--&lt;!&ndash;                        style="width: 200px; height: 45px; text-align: center; font-size: 17px; display: block; margin: 0 auto; padding: 8px 24px; border: none; border-radius: 4px; background-color: #07c160; color:#fff;">打开小程序2</button>&ndash;&gt;-->
<!--&lt;!&ndash;            </template>&ndash;&gt;-->
<!--&lt;!&ndash;        </wx-open-launch-weapp>&ndash;&gt;-->
<!--&lt;!&ndash;    </div>&ndash;&gt;-->

<!--&lt;!&ndash;    <div id="desktop-web-container" class="hidden">&ndash;&gt;-->
<!--&lt;!&ndash;        <p class="">请在手机打开网页链接</p>&ndash;&gt;-->
<!--&lt;!&ndash;    </div>&ndash;&gt;-->
<!--</div>-->
</body>

</html>